#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=4e6+100;
typedef int LL;
const int mod=1e9+7;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
LL primes[maxn];
LL v[maxn];
LL m=0;
LL ksm(LL a,LL b){
    LL ans=1;
    while(b){
        if(b&1)ans=ans*a%mod;
        a=a*a%mod;
        b/=2;
    }
    return ans%mod;
}
void getprimes(int n)
{
	for(LL i=2;i<=n;i++)
	{
		if(v[i]==0) {v[i]=i;primes[++m]=i;}
		for(LL j=1;j<=m;j++)
		{
			if(primes[j]>v[i]||primes[j]>n/i)  break;
			v[i*primes[j]]=primes[j];
		}
	}
}
LL get(LL x){
    LL sum=0;
    while(x>0) x/=10,sum++;
    return  sum;
}
LL solve(LL x){
    long long sum=0;
    if(x==1) return 0;
    LL tmp=x;
    while(tmp!=1){
        LL t=v[tmp];
        while(tmp%t==0){
            tmp/=t;
            sum=(sum*ksm(10,get(t))%mod+t%mod)%mod;
        }
    }
    if(tmp>1) sum=(sum*ksm(10,get(tmp))%mod+tmp%mod)%mod;
    return sum%mod;
}
int main(void)
{
  getprimes(4000000);

  LL n;n=read();
  long long ans=0;
  for(LL i=1;i<=n;i++){
    ans=(ans%mod+solve(i)%mod)%mod;
  }
  printf("%lld\n",ans);
return 0;
}
